﻿Imports Sistema_InformacionNaviera.BC
Imports Sistema_InformacionNaviera.BE
Imports Sistema_InformacionNavier.UTIL

Public Class Login
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim vsUsuario As String = IdUsuario.Value
        vsUsuario = "mfigueroa"
        Session("idIusuario") = vsUsuario
        Response.Redirect("Page/Default_1.aspx")
    End Sub

    Protected Sub ibLogin_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibLogin.Click
        Dim vsUsuario As String = IdUsuario.Value
        Dim vsPassword As String = Idpassword.Value
        Dim objUsuarioBe As New UsuarioBE
        'vsUsuario = "mfigueroa"
        Session("idIusuario") = vsUsuario
        objUsuarioBe.CodiUsu = vsUsuario
        objUsuarioBe.PswdUsu = vsPassword

        ValidarUser(objUsuarioBe)
        'Response.Redirect("Page/Default_1.aspx")

    End Sub

    Sub ValidarUser(obj As UsuarioBE)
        Dim objUsuarioBC As New UsuarioBC
        Dim bValido As Boolean = False
        bValido = objUsuarioBC.ValidarUser(obj)
        If Not bValido Then
            lblValidarUser.Visible = True
        Else
            lblValidarUser.Visible = False

            Response.Redirect("Page/Default_1.aspx")
        End If
    End Sub
End Class